/* 动态连接点样式 */
.dynamic-handle-container {
  position: relative;
  display: inline-block;
}

.dynamic-connection-handle {
  position: absolute !important;
  width: 10px !important;
  height: 10px !important;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%) !important;
  border: 2px solid white !important;
  border-radius: 50% !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  opacity: 0.7 !important;
  cursor: crosshair !important;
  z-index: 1000 !important;
}

/* 激活状态 */
.dynamic-connection-handle.active {
  opacity: 1 !important;
  transform: scale(1.3) !important;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.4), 0 4px 16px rgba(59, 130, 246, 0.3) !important;
  z-index: 1001 !important;
}

/* 已连接状态 */
.dynamic-connection-handle.connected {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3) !important;
}

.dynamic-connection-handle.connected.active {
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.4), 0 4px 16px rgba(16, 185, 129, 0.3) !important;
}

/* 不同位置的连接点 */
.dynamic-handle-top {
  top: -6px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
}

.dynamic-handle-bottom {
  bottom: -6px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
}

.dynamic-handle-left {
  left: -6px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
}

.dynamic-handle-right {
  right: -6px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
}

/* 连接数量指示器 */
.connection-count-indicator {
  position: absolute;
  top: -8px;
  right: -8px;
  pointer-events: none;
  z-index: 1002;
}

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  font-size: 10px;
  font-weight: 700;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
  animation: countPulse 2s infinite;
}

@keyframes countPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.9;
  }
}

/* 方向指示器 */
.direction-indicator {
  position: absolute;
  pointer-events: none;
  font-size: 12px;
  font-weight: bold;
  color: #3b82f6;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  z-index: 1003;
  animation: directionFadeIn 0.3s ease-out;
}

.direction-indicator.direction-top {
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
}

.direction-indicator.direction-bottom {
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
}

.direction-indicator.direction-left {
  right: 100%;
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
}

.direction-indicator.direction-right {
  left: 100%;
  top: 50%;
  transform: translateY(-50%) translateX(4px);
}

@keyframes directionFadeIn {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(-4px) scale(0.8);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px) scale(1);
  }
}

/* 不同类型的连接点样式 */
.dynamic-handle-source {
  border-color: #10b981 !important;
}

.dynamic-handle-target {
  border-color: #f59e0b !important;
}

/* 悬停效果增强 */
.dynamic-connection-handle:hover {
  transform: scale(1.4) !important;
  box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.3), 0 6px 20px rgba(59, 130, 246, 0.4) !important;
}

.dynamic-connection-handle.connected:hover {
  box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.3), 0 6px 20px rgba(16, 185, 129, 0.4) !important;
}

/* 动态位置调整动画 */
.dynamic-connection-handle.position-adjusting {
  animation: positionAdjust 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes positionAdjust {
  0% {
    transform: scale(1);
    opacity: 0.7;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
    box-shadow: 0 0 0 8px rgba(59, 130, 246, 0.2);
  }
  100% {
    transform: scale(1);
    opacity: 0.7;
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .dynamic-connection-handle {
    width: 12px !important;
    height: 12px !important;
  }
  
  .count-badge {
    width: 14px;
    height: 14px;
    font-size: 9px;
  }
  
  .direction-indicator {
    font-size: 10px;
  }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
  .dynamic-connection-handle {
    border-width: 3px !important;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.8) !important;
  }
  
  .dynamic-connection-handle.active {
    box-shadow: 0 0 0 6px rgba(0, 0, 0, 0.8), 0 4px 16px rgba(0, 0, 0, 0.5) !important;
  }
}
